<?php

namespace Zilla\FrontBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Zilla\FrontBundle\Entity\ProductCategory
 *
 * @ORM\Table(name="product_category")
 * @ORM\Entity(repositoryClass="Zilla\FrontBundle\Entity\ProductCategoryRepository")
 */
class ProductCategory
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * 
     * @var ArrayCollection $subCateogries
     * 
     * @ORM\OneToMany(targetEntity="ProductCategory" , cascade={"all"}, mappedBy="superCategory")
     */
    private $subCategories;

    /**
     * 
     * @var ArrayCollection $subCateogries
     * 
     * @ORM\ManyToOne(targetEntity="ProductCategory" , inversedBy="subCategories")
     * @ORM\JoinColumn(name="sub_category_id", referencedColumnName="id")
     */
    private $superCategory;
    
    /**
     * 
     * @var ArrayCollection $products
     * 
     * @ORM\OneToMany(targetEntity="Product", mappedBy="productCategory")
     */
    private $products;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return ProductCategory
     */
    public function setName($name)
    {
        $this->name = $name;
    
        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }
    
    /**
     *
     * @return ArrayCollection
     */
    public function getSubCategories()
    {
        return $this->subCategories;
    }

    /**
     *
     * @param ArrayCollection $subCategories 
     */
    public function setSubCategories(ArrayCollection $subCategories)
    {
        $this->subCategories = $subCategories;
    }

    /**
     *
     * @return ProductCategory
     */
    public function getSuperCategory()
    {
        return $this->superCategory;
    }

    /**
     *
     * @param ProductCategory $superCategory 
     */
    
    public function setSuperCategory($superCategory)
    {
        $this->superCategory = $superCategory;
    }
    
    /**
     *
     * @return ArrayCollection
     */
    public function getProducts()
    {
        return $this->products;
    }

    /**
     *
     * @param ArrayCollection $products 
     */
    public function setProducts(ArrayCollection $products)
    {
        $this->products = $products;
    }
    
    /**
     *
     * @param Product $product 
     */
    public function addProduct(Product $product)
    {
        $this->products->add($product);
    }


}
